/**
 * @details: 命令行根节点类型
 * @brief: 
 * @version: 1.0
 * @author: liuri
 * @Date: 2021-10-05 03:36:26
 * @LastEditors: liuri
 * @LastEditTime: 2021-10-05 10:09:41
 * @FilePath: /TestProject/cPath/vtysh/cmd_node.h
 * @Copyright (C) 2021 liuri. All rights reserved.
 */
#ifndef __CMD_NODE_H__
#define __CMD_NODE_H__

#include "vector.h"

enum node_type 
{
    AUTH_NODE,			    /* Authentication mode of vty interface. */
    RESTRICTED_NODE,		/* Restricted view mode */ 
    VIEW_NODE,			    /* View node. Default mode of vty interface. */
    AUTH_ENABLE_NODE,		/* Authentication mode for change enable. */
    ENABLE_NODE,			/* Enable node. */
    CONFIG_NODE,			/* Config node. Default mode of config file. */
    VRF_NODE,			    /* VRF node. */
    SERVICE_NODE, 		    /* Service node. */
    DEBUG_NODE,			    /* Debug node. */
    AAA_NODE,			    /* AAA node. */
};




struct cmd_node 
{
    /* Node index. */
    enum node_type node;		

    /* Prompt character at vty interface. */
    const char *prompt;			

    /* Is this node's configuration goes to vtysh ? */
    int vtysh;
    
    /* Node's configuration write function */
    int (*func) (struct vty *);

    /* Vector of this node's command list. */
    vector cmd_vector;
    
    /* Hashed index of command node list, for de-dupping primarily */
    struct hash *cmd_hash;
};


// 获取根节点下所有的命令
vector cmd_node_ele_vec_get(enum node_type ntype);


void cmd_node_init();

#endif
